<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>展开运算符</title>
</head>
<body>

<script>
    /*
        展开运算符写在数组里会默认使用数组格式进行操作
        对象也是同理

    */
    let arr = [1,2,3],
        ary = [4,5,6];
    // arr = [1,2,3,ary]; //[1,2,3,[4,5,6]]
    arr = [1,2,3,...ary] //[1,2,3,4,5,6]
    console.log(arr);

    let obj = {name:'张三'},
        obj2 = {name2:'李四'};
    let obj3 = {...obj, ...obj2};
    let obj4 = {...obj};
    console.log(obj3);//{name:'张三',name2:'李四'}
    console.log(obj === obj4);//false 这两个对象的内容一样但是地址不一样

    function fn(a,b,...c) {
        console.log(a)
        console.log(b)
        console.log(c)
    }
    fn(1,2,3,4,5,6,7,8,9);

    let src = 'hello';
    // let  arrStr = src.split(''); //原始的拆分
    // console.log(arrStr); 'h,e,l,l,o'
    let arrStr = [...src];
    console.log(arrStr);//["h", "e", "l", "l", "o"]
    console.log(...src)//h e l l o
</script>

</body>
</html>